// $ANTLR 3.2 Sep 23, 2009 12:02:23 /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g 2010-11-14 16:31:16

package com.dynamicalsoftware.news.parser;
import java.io.PrintWriter;


import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class NewsRequestParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "STRING", "INT", "WS", "ESC_SEQ", "HEX_DIGIT", "UNICODE_ESC", "OCTAL_ESC", "'repository:'", "'topic:'", "','", "'interest:'", "'format:'", "'count:'"
    };
    public static final int ESC_SEQ=7;
    public static final int WS=6;
    public static final int T__16=16;
    public static final int T__15=15;
    public static final int T__12=12;
    public static final int T__11=11;
    public static final int T__14=14;
    public static final int T__13=13;
    public static final int UNICODE_ESC=9;
    public static final int OCTAL_ESC=10;
    public static final int HEX_DIGIT=8;
    public static final int INT=5;
    public static final int EOF=-1;
    public static final int STRING=4;

    // delegates
    // delegators


        public NewsRequestParser(TokenStream input) {
            this(input, new RecognizerSharedState());
        }
        public NewsRequestParser(TokenStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return NewsRequestParser.tokenNames; }
    public String getGrammarFileName() { return "/home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g"; }


    public PrintWriter writer = null;



    // $ANTLR start "ask"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:17:1: ask : ( repository | topic | interests | format | count )+ ;
    public final void ask() throws RecognitionException {
        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:17:5: ( ( repository | topic | interests | format | count )+ )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:18:2: ( repository | topic | interests | format | count )+
            {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:18:2: ( repository | topic | interests | format | count )+
            int cnt1=0;
            loop1:
            do {
                int alt1=6;
                switch ( input.LA(1) ) {
                case 11:
                    {
                    alt1=1;
                    }
                    break;
                case 12:
                    {
                    alt1=2;
                    }
                    break;
                case 14:
                    {
                    alt1=3;
                    }
                    break;
                case 15:
                    {
                    alt1=4;
                    }
                    break;
                case 16:
                    {
                    alt1=5;
                    }
                    break;

                }

                switch (alt1) {
            	case 1 :
            	    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:19:2: repository
            	    {
            	    pushFollow(FOLLOW_repository_in_ask42);
            	    repository();

            	    state._fsp--;


            	    }
            	    break;
            	case 2 :
            	    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:21:2: topic
            	    {
            	    pushFollow(FOLLOW_topic_in_ask48);
            	    topic();

            	    state._fsp--;


            	    }
            	    break;
            	case 3 :
            	    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:23:2: interests
            	    {
            	    pushFollow(FOLLOW_interests_in_ask54);
            	    interests();

            	    state._fsp--;


            	    }
            	    break;
            	case 4 :
            	    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:25:2: format
            	    {
            	    pushFollow(FOLLOW_format_in_ask60);
            	    format();

            	    state._fsp--;


            	    }
            	    break;
            	case 5 :
            	    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:27:2: count
            	    {
            	    pushFollow(FOLLOW_count_in_ask66);
            	    count();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "ask"


    // $ANTLR start "repository"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:30:1: repository : 'repository:' STRING ;
    public final void repository() throws RecognitionException {
        Token STRING1=null;

        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:30:12: ( 'repository:' STRING )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:31:2: 'repository:' STRING
            {
            match(input,11,FOLLOW_11_in_repository80); 
            STRING1=(Token)match(input,STRING,FOLLOW_STRING_in_repository82); 
             writer.write("<tr><td>repository</td><td>" + (STRING1!=null?STRING1.getText():null) + "</td></tr>"); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "repository"


    // $ANTLR start "topic"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:34:1: topic : 'topic:' STRING ;
    public final void topic() throws RecognitionException {
        Token STRING2=null;

        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:34:7: ( 'topic:' STRING )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:35:2: 'topic:' STRING
            {
            match(input,12,FOLLOW_12_in_topic95); 
            STRING2=(Token)match(input,STRING,FOLLOW_STRING_in_topic97); 
             writer.write("<tr><td>topic to cover</td><td>" + (STRING2!=null?STRING2.getText():null) + "</td></tr>"); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "topic"


    // $ANTLR start "interests"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:38:1: interests : interest ( ',' STRING )* ;
    public final void interests() throws RecognitionException {
        Token STRING3=null;

        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:38:11: ( interest ( ',' STRING )* )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:39:2: interest ( ',' STRING )*
            {
            pushFollow(FOLLOW_interest_in_interests110);
            interest();

            state._fsp--;

            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:39:11: ( ',' STRING )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( (LA2_0==13) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:39:13: ',' STRING
            	    {
            	    match(input,13,FOLLOW_13_in_interests114); 
            	    STRING3=(Token)match(input,STRING,FOLLOW_STRING_in_interests116); 
            	     writer.write("<tr><td>area of interest</td><td>" + (STRING3!=null?STRING3.getText():null) + "</td></tr>"); 

            	    }
            	    break;

            	default :
            	    break loop2;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "interests"


    // $ANTLR start "interest"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:43:1: interest : 'interest:' STRING ;
    public final void interest() throws RecognitionException {
        Token STRING4=null;

        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:43:10: ( 'interest:' STRING )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:44:2: 'interest:' STRING
            {
            match(input,14,FOLLOW_14_in_interest136); 
            STRING4=(Token)match(input,STRING,FOLLOW_STRING_in_interest138); 
             writer.write("<tr><td>area of interest</td><td>" + (STRING4!=null?STRING4.getText():null) + "</td></tr>"); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "interest"


    // $ANTLR start "format"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:47:1: format : 'format:' STRING ;
    public final void format() throws RecognitionException {
        Token STRING5=null;

        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:47:8: ( 'format:' STRING )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:48:2: 'format:' STRING
            {
            match(input,15,FOLLOW_15_in_format151); 
            STRING5=(Token)match(input,STRING,FOLLOW_STRING_in_format153); 
             writer.write("<tr><td>format of response</td><td>" + (STRING5!=null?STRING5.getText():null) + "</td></tr>"); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "format"


    // $ANTLR start "count"
    // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:51:1: count : 'count:' INT ;
    public final void count() throws RecognitionException {
        Token INT6=null;

        try {
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:51:7: ( 'count:' INT )
            // /home/glenn/web/NewsWidget/src/com/dynamicalsoftware/news/parser/NewsRequest.g:52:2: 'count:' INT
            {
            match(input,16,FOLLOW_16_in_count166); 
            INT6=(Token)match(input,INT,FOLLOW_INT_in_count168); 
             writer.write("<tr><td>max number of items to return</td><td>" + (INT6!=null?INT6.getText():null) + "</td></tr>"); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ;
    }
    // $ANTLR end "count"

    // Delegated rules


 

    public static final BitSet FOLLOW_repository_in_ask42 = new BitSet(new long[]{0x000000000001D802L});
    public static final BitSet FOLLOW_topic_in_ask48 = new BitSet(new long[]{0x000000000001D802L});
    public static final BitSet FOLLOW_interests_in_ask54 = new BitSet(new long[]{0x000000000001D802L});
    public static final BitSet FOLLOW_format_in_ask60 = new BitSet(new long[]{0x000000000001D802L});
    public static final BitSet FOLLOW_count_in_ask66 = new BitSet(new long[]{0x000000000001D802L});
    public static final BitSet FOLLOW_11_in_repository80 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_STRING_in_repository82 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_12_in_topic95 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_STRING_in_topic97 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_interest_in_interests110 = new BitSet(new long[]{0x0000000000002002L});
    public static final BitSet FOLLOW_13_in_interests114 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_STRING_in_interests116 = new BitSet(new long[]{0x0000000000002002L});
    public static final BitSet FOLLOW_14_in_interest136 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_STRING_in_interest138 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_15_in_format151 = new BitSet(new long[]{0x0000000000000010L});
    public static final BitSet FOLLOW_STRING_in_format153 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_16_in_count166 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_INT_in_count168 = new BitSet(new long[]{0x0000000000000002L});

}